<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>项目列表(查重)</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
<div id="pageInTab" class="pageInTab">
<div class="searchArea">
    <form id="searchBar">
        <div class="fieldset1 clearFix">
           <input type="hidden" name="reCstNm" id="reCstNm" value="" />
           <input type="hidden" name="reCertNo" id="reCertNo" value="" />
           <input type="hidden" name="reMp1" id="reMp1" value="" />
           
            <c:if test="${cstTypCd==1}">
            <div class="fieldBox" >
             <div class="label">姓名</div>
                <div class="field">
                    <input name="reCstNm" id="reCstNm" type="text" class="ui-textbox" value="${reCstNm}">
                </div>
            </div>
            <div class="fieldBox" >
             <div class="label">手机号</div>
                <div class="field">
                    <input name="reMp1" id="reMp1" type="text" class="ui-textbox" value="${reMp1}">
                </div>
            </div>
            <div class="fieldBox" >
             <div class="label">身份证号</div>
                <div class="field">
                    <input name="reCertNo" id="reCertNo" type="text" class="ui-textbox" value="${reCertNo}">
                </div>
            </div>
            <div class="fieldBox" >
             <div class="label">身份证地址</div>
                <div class="field">
                    <input name="reIdAddr" id="reIdAddr" type="text" class="ui-textbox" value="${reIdAddr}">
                </div>
            </div>
            <div class="fieldBox" >
                <div class="label">工作单位</div>
                <div class="field">
                    <input name="reWorkPlc" id="reWorkPlc" type="text" class="ui-textbox" value="${reWorkPlc}">
                </div>
            </div>
            <div class="fieldBox" >
                <div class="label">通讯地址</div>
                <div class="field">
                    <input name="rePostAddr" id="rePostAddr" type="text" class="ui-textbox" value="${rePostAddr}">
                </div>
            </div>
            <div class="fieldBox" >
                <div class="label">单位地址</div>
                <div class="field">
                    <input name="reWorkAddr" id="reWorkAddr" type="text" class="ui-textbox" value="${reWorkAddr}">
                </div>
            </div>
            <div class="fieldBox" >
                <div class="label">vin</div>
                <div class="field">
                    <input name="vinListStr" id="vinListStr" type="text" class="ui-textbox" value="${vinListStr}">
                </div>
            </div>
            </c:if>
            <c:if test="${cstTypCd==2}">
            <div class="fieldBox" >
                <div class="label">法人承租人</div>
                <div class="field">
                    <input name="reWorkPlc" id="reWorkPlc" type="text" class="ui-textbox" value="${reWorkPlc}">
                </div>
            </div>
            <div class="fieldBox" >
             <div class="label">手机号</div>
                <div class="field">
                    <input name="reMp1" id="reMp1" type="text" class="ui-textbox" value="${reMp1}">
                </div>
            </div>
            <div class="fieldBox" >
                <div class="label">联系地址</div>
                <div class="field">
                    <input name="rePostAddr" id="rePostAddr" type="text" class="ui-textbox" value="${rePostAddr}">
                </div>
            </div>
           </c:if>
            <div class="clearFix"></div>
            <div class="btnsBox">
               <span id="searchBtn"  class="sq-button sq-button-round">查询</span>
   
            </div>
            <!-- 隐藏客户ID, 提供给客户管理中 项目列表使用 -->
			<div class="fieldBox col_100" style="display:none;">
		       <div class="field">
		        	<input name="cstId" id="cstId" type="text" class="ui-textbox" value="${cstId}">
		        	<input name="fromPrjFlagNm" id="fromPrjFlagId" type="text" class="ui-textbox" value="${fromPrjFlag}">
		        	<input name="cstNmNm" id="cstNmId" type="text" class="ui-textbox" value="${cstNm}">
		        	<!-- 流程跟踪 隐藏选中数据项目ID -->
		        	<input name="projectId" id="projectId" type="text" class="ui-textbox" value="">
		       </div>
		    </div>
        </div>
    </form>
</div>
<div id="ligergrid1" class="sq-grid"></div> 
</div>
</div>


<div id="chooseFlowDIV" style="display:none">
    <div id="ligergrid_flowStart" class="sq-grid"></div>
</div>
<script type="text/javascript">
	var grid = null;
	var type = '${type}'; //查重类型
	var value = '${value}'; //查重内容
	var queryFlag = '${queryFlag}'; //只查询列表
	var updateFlag = '${updateFlag}';//业务移交
	var taskTransfer = '${taskTransfer}';//业务交接
	var updateSunFlag = '${updateSunFlag}';//供应商及账号修改
	
	var _reCstNm = '${reCstNm}';
	var _reCertNo = '${reCertNo}';
	var _reIdAddr = '${reIdAddr}';
	var _reMp1 = '${reMp1}';
	var _reWorkPlc = '${reWorkPlc}';
	var _rePostAddr = '${rePostAddr}';
	var _reWorkAddr = '${reWorkAddr}';
	var _cstTypCd = '${cstTypCd}';
	var _prjId = '${prjId}';
	var _vinListStr = '${vinListStr}';
	var pageInApp={}; // to 下一级子窗口 接口
    var pageInTab=null;
	$(function () {
		var params = "?cstTypCd="+_cstTypCd+"&prjId="+_prjId;//默认条件
	    $("#ligergrid1").ligerGrid({
	    	url: '<%=path%>/project/prjbscinfo/reInitList.do'+params,
	    	method : 'get',
	    	parms:{
	    		reCstNm:_reCstNm,
	    		reCertNo:_reCertNo,
	    		reIdAddr:_reIdAddr,
	    		reMp1:_reMp1,
	    		reWorkPlc:_reWorkPlc,
	    		rePostAddr:_rePostAddr,
	    		reWorkAddr:_reWorkAddr,
	    		vinListStr:_vinListStr
	    	},
	        columns: [
	             { display: '项目名称', name: 'prjNm', align:'left',minWidth: 140 ,
	            	render: function (rowdata, rowindex, value, column) { 
	            		var h = '';
	            			if(value&&value!="null"){
	            		    h+='<a href="javascript:detailBtn(';
	                        h+="'"+rowdata.id+"'";
	                        h+=')">'+value+'</a>'
	            			}
	                        return h;
	            		},
	            	enabledSort:true}, 
	             { display: '合同号', name: 'lsCntNo', minWidth: 140 , enabledSort:true}, 
	             { display: '客户', name: 'cstNm', minWidth: 100,align:'center', enabledSort:true},
	             { display: '客户经理', name: 'cstMgrNm', minWidth: 100,align:'center', enabledSort:true},
	             { display: '身份证号', name: 'reCertNo', minWidth: 100,align:'center', enabledSort:true},
	             { display: '电话1', name: 'reMp1', minWidth: 100,align:'center', enabledSort:true},
	             { display: '电话2', name: 'reMp2', minWidth: 100,align:'center', enabledSort:true},
	             { display: '身份证地址', name: 'reIdAddr', minWidth: 140,align:'center', enabledSort:true},
	             { display: '工作单位', name: 'reWorkPlc', minWidth: 140,align:'center', enabledSort:true},
	             { display: '通讯地址', name: 'rePostAddr', minWidth: 140,align:'center', enabledSort:true},
	             { display: '单位地址', name: 'reWorkAddr', minWidth: 140,align:'center', enabledSort:true},
	             { display: '所属机构', name: 'buOrgCdNm', width: 100 , enabledSort:true},
	             { display: '省公司', name: 'prOrgCdNm', width: 100 , enabledSort:true},
	             { display: '分公司', name: 'cyOrgCdNm', width: 100 , enabledSort:true},
	             { display: '项目类型', name: 'prjTypCdNm', width: 140, enabledSort:true},
	             { display: '业务模式', name: 'bizTypCdNm', minWidth: 140 , enabledSort:true},
	             { display: '项目状态', name: 'prjStsCdNm', minWidth: 100 , enabledSort:true},
	             { display: '申请单号', name: 'pNo', minWidth: 140 , 
	              	render: function (rowdata, rowindex, value, column) { 
	            		var h = '';
            			if(value&&value!="null"){
            				if(StringUtils.isNotEmpty(rowdata.buOrgCd) && rowdata.buOrgCd==ProjectConstant.CODE_BU_ORG_CD_CAR){
		            		    h+='<a href="javascript:commShowFlowForCarBiz(';
            				}else if(StringUtils.isNotEmpty(rowdata.buOrgCd) && rowdata.buOrgCd==ProjectConstant.CODE_BU_ORG_CD_ZC){
		            		    h+='<a href="javascript:commShowFlowForBusBiz(';
            				}else{
		            		    h+='<a href="javascript:commShowFlow(';
            				}
	            		    h+="'"+rowdata.pInstId+"',";
	            		    h+="'"+rowdata.prjStsCd+"',";
	            		    h+="'"+rowdata.id+"'";
	            		    h+=')">'+value+'</a>'
            			}
                        return h;
            		},
	            	enabledSort:true}, 
	            { display: '数据来源', name: 'dsCdNm', minWidth: 100 , enabledSort:true},
	            { display: '创建时间', name: 'crtTm', minWidth: 100 , render:renderDate, enabledSort:true},
	            { display: '操作',isSort: false,width: 320,align:'left',
	                render: function (rowdata, rowindex, value){
	                	 var h="";
	                    h+='<a class="sq-button-hasicon" href="javascript:detailBtn(';
	                    h+="'"+rowdata.id+"'";
	                    h+=')"><i class="sqBtnIco_2"></i>详情</a>';
                        var j="";
                        j+='<a class="sq-button-hasicon" href="javascript:searchCredit(';
                        j+="'"+rowdata.id+"'";
                        j+=')"><i class="sqBtnIco_1"></i>征信查询</a>';
                        var k="";
                        k+='<a class="sq-button-hasicon" href="javascript:payDetail(';
	                    k+="'"+rowdata.id+"'";
	                    k+=')"><i class="sqBtnIco_3"></i>还款情况</a>';
	                    var l="";
	                    l+='<a class="sq-button-hasicon" href="javascript:showReport(';
	                    l+="'"+rowdata.id+"'";
	                    l+=')"><i class="sqBtnIco_29"></i>评估报告</a>';
	                    return h + j + k + l;
	                }
	            }
	        ],
	        pageSize:10,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-20,
	        //isScroll: false,
	        checkbox:true,
	        delayLoad:true,
	        rownumbers:true,
	    });
	 //   initOrgTree();
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	    $("#searchBar").ligerForm();
	    $("#searchBtn").click(function(event) {
	         var form = new liger.get("searchBar");
	         var data = form.getData();
	         data["crtTm"] = $("#crtTm").val();
	         for (name in data){
	            grid.setParm(name,data[name]);
	         };
	         //grid.setParm('reCertNo','');
	         //grid.setParm('reCstNm','');
	         //grid.setParm('reMp1','');
	         //grid.setParm('vinListStr','');
	        grid.reload();
	    });
	
	    //var form = new liger.get("searchBar");
        //var data = form.getData();
        //data["crtTm"] = $("#crtTm").val();
        //for (name in data){
          // grid.setParm(name,data[name]);
        //};
        
        grid.reload();
	    $("#pageloading").hide();
	});
	    
	    
	function initOrgTree(){
    	var params = {};
    		params.cstMgrOrgCd = '${currOrg}';
    	 searchOrgTree = $("#cstMgrOrgCd").ligerComboBox({
    		 width: 480,
             selectBoxWidth: 480,
             selectBoxHeight: 150,
             //限制只能选叶节点，父节点不能点击
             treeLeafOnly: false,
             valueField: 'orgCd',
             textField: 'orgDispNm',
             showTreePath: true,
             tree: {
                 ajaxType: 'get',
                 idFieldName:'orgCd',
                 textFieldName: 'orgDispNm',
                 checkbox: false,
                 parentIcon: "none",
                 childIcon: "none",
                 needCancel : false
             }
         });
    	 $.ajax({
     		type: 'get',
     		dataType:'json',
     		data: params,
     		url: '<%=path%>/project/prjbscinfo/searchBuOrgTree.do',
     		success:function(msg){
     			if(msg.success == 1){
     				searchOrgTree.treeManager.setData(msg.data);
     				searchOrgTree.clear();
     				searchOrgTree.setValue('${currOrg}');
     			}else{
     				 $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
     			}
     		}
     	});
    	 
    }    
	
	function detailBtn(id){
		var fromPrjFlag = true;
		var detailFlag = true;
		var _flag = $("#fromPrjFlagId").val();//来自哪里
		if(StringUtils.isNotEmpty(_flag)){
			if(_flag == 'false'){
				fromPrjFlag = false;
			}
		}
		Add_navTab('tab_project_detail'+id,'项目详情','<%=path%>/project/prjbscinfo/toModifyPage.do?fromPrjFlag='+fromPrjFlag+'&&id='+id+'&&detailFlag='+detailFlag);
	}
	
	function searchCredit(_projectId) {
        if(!_projectId)return;
        Add_navTab("toTripartitePage"+_projectId, "人行征信及三方", '<%=path%>/riskctrl/rskctrl/toMainPage.do?id='+_projectId);
    }
	function payDetail(prjId){
		var payDetailUrl = '<%=path%>/project/prjprdpayschm/toPrjPrdPaySchMAndDListPage.do?prjId='+prjId;
		Add_navTab('tab_prj_quat_prps_pay_prj'+prjId,'查看还款情况(项目)',payDetailUrl);
	}
	function showReport(id){
		 $.ligerDialog.open({title: '报告列表',height: 300,width: 550, 
	        	url: '<%=path%>/car300/infCar300Rec/toReportListPage.do?prjId='+id
	        });
	};
	    
	
	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		}
		return dateStr;
	}
	
</script>

</body>
</html>